#include "StdAfx.h"
#include "SketchPlane.h"
#include "AnyView.h"
#include "RenderEngine.h"
CSketchPlane::CSketchPlane(CAnyView* pView):
m_pView(pView),
m_Location(0,0,0),
m_Direction(0,0,1)
{
}

CSketchPlane::~CSketchPlane(void)
{
}

void CSketchPlane::Update()
{
	m_pView->GetRender()->UpdateGridPlane(*this);

}
gp_Ax3 CSketchPlane::GetPlane() const
{
	return gp_Ax3(m_Location, m_Direction);
}

CSketchPlane* CSketchPlane::Create(CAnyView* pView, STD_SKETCH_PLANE nPlaneType)
{
	CSketchPlane* pPlane = new CSketchPlane(pView);
	switch(nPlaneType)
	{
	case STD_PLANE_XOZ:
		pPlane->SetDirection(gp_Dir(0,1,0));
		break;
	case STD_PLANE_XOY:
		pPlane->SetDirection(gp_Dir(0,0,1));
		break;
	case STD_PLANE_YOZ:
		pPlane->SetDirection(gp_Dir(1,0,0));
		break;
	default:
		ASSERT(FALSE);
	}

	return pPlane;
}